| Conditions | 2 |
| Total Lines | 13 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Inject } from '@nestjs/common'; |
||
| 14 | |||
| 15 | public async execute(command: CreateContactCommand): Promise<string> { |
||
| 16 | const { firstName, lastName, company, email, phoneNumber, notes } = command; |
||
| 17 | |||
| 18 | if (!firstName && !lastName && !company) { |
||
| 19 | throw new EmptyContactException(); |
||
| 20 | } |
||
| 21 | |||
| 22 | const contact = await this.contactRepository.save( |
||
| 23 | new Contact(firstName, lastName, company, email, phoneNumber, notes) |
||
| 24 | ); |
||
| 25 | |||
| 26 | return contact.getId(); |
||
| 27 | } |
||
| 29 |